#ifndef __GS_ROLE_H__
#define __GS_ROLE_H__

#define ROLE_NONE  0
#define ROLE_HERO  1
#define ROLE_SWORD 2
#define ROLE_BOSS  3

#define STATUS_IDLE            0
#define STATUS_PASS            1
#define STATUS_ATTACK          2
#define STATUS_CRITICAL_ATTACK 3
#define STATUS_DEFEND          4
#define STATUS_DODGE           5

typedef struct Role {
    int who;
    void* target;
    char* group;
} Role;

typedef struct Hero {
    double max_hp;
    double max_mp;

    double hp;
    double mp;

    double hp_recover_rate;
    double mp_recover_rate;

    int status;

    double mp_consumption;

    double attack;

    double critical_multiply;
    double critical_rate;
} Hero;

typedef struct Boss {
    double max_hp;
    double max_mp;

    double hp;
    double mp;

    double hp_recover_rate;
    double mp_recover_rate;

    int status;

    double mp_consumption;

    double attack;

    double critical_multiply;
    double critical_rate;
} Boss;

typedef struct Sword {
    double max_hp;
    double max_mp;

    double hp;
    double mp;

    double hp_recover_rate;
    double mp_recover_rate;

    int status;

    double mp_consumption;

    double attack;

    double damage;
} Sword;

Role* RoleCreate(const char* group);
void RoleDestroy();

Hero* HeroCreate(double max_hp, double hp_recover_rate, double max_mp, double mp_recover_rate, double mp_consumption,
        double attack, double critical_multiply, double critical_rate);
void HeroDestroy(Hero* hero);
void HeroReset(Hero* hero, Boss* boss);
void HeroAttack(Hero* hero, Sword* sword, Boss* boss);
void HeroCriticalAttack(Hero* hero, Sword* sword, Boss* boss);
void HeroPass(Hero* hero);
void HeroStates(Hero* hero);
int HeroBufferSize(Hero* hero);
int HeroPrint(Hero* hero, char* b);

Boss* BossCreate(double max_hp, double hp_recover_rate, double max_mp, double mp_recover_rate, double mp_consumption,
        double attack, double critical_multiply, double critical_rate);
void BossDestroy(Boss* boss);
void BossReset(Boss* boss, Hero* hero);
void BossAttack(Boss* boss, Hero* hero, Sword* sword);
void BossDefend(Boss* boss);
void BossPass(Boss* boss);
void BossStates(Boss* boss);
int BossBufferSize(Boss* boss);
int BossPrint(Boss* boss, char* b);

Sword* SwordCreate(double max_hp, double hp_recover_rate, double max_mp, double mp_recover_rate, double mp_consumption,
        double attack, double damage);
void SwordDestroy(Sword* sword);
void SwordReset(Sword* sword);
void SwordDodge(Sword* sword, Boss* boss);
void SwordPass(Sword* sword);
void SwordStates(Sword* sword);
int SwordBufferSize(Sword* sword);
int SwordPrint(Sword* sword, char* b);

#endif
